package com.pg.free.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.pg.free.util.Const;
import com.pg.free.util.Context;
import com.pg.free.util.Logger;

public class LogoScreen extends GameScreen {

	private Texture logo;

	public LogoScreen() {
		
	}

	@Override
	public void show() {
		logo = new Texture(Gdx.files.internal("image/logo.png"));
	}

	@Override
	public void hide() {
		logo.dispose();
		Logger.debug("LogoScreen.logo", "dispose");
	}

	@Override
	public void render(float delta) {
		update(delta);
		super.glClear();
		batch.begin();
		batch.draw(logo, Const.viewWidth / 2 - logo.getWidth() / 2,
				Const.viewHeight / 2 - logo.getHeight() / 2);
		batch.end();
	}
	
	private float totalTime = 20f;
	private float vTime = 10f;
	private float stayTime = 0;
	
	private void update(float delta) {
		stayTime += vTime * delta;
		Logger.debug("stayTime", "" + stayTime);
		if (stayTime >= totalTime){
			Context.game.setCurrentScreen(new MenuScreen());
		}
	}
}
